package 华为机试8月23日;

import java.util.Scanner;
import java.util.TreeSet;


public class 华为第二题1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(func(s));
        }
        sc.close();
    }

    private static String func(String s) {

        char[] a = s.toCharArray();
        TreeSet<String> ts = new TreeSet<>();
        for (int i = 0; i < a.length; i++) {
            ts.add(String.valueOf(a[i]));
        }
        System.out.println(ts.toString());
        String tmp = ts.toString().replaceAll("[\\[\\],]", "").replaceAll("\\s+", "").trim();
        return new StringBuilder(tmp).reverse().toString();




    }
}
